# coding=utf-8
"""
Author: Mr.夏末
@Function: 关联算法
"""
from class11.webkeys import Web


def func(a,b):
    print(a,b)

# 数据使用字典存放
relations = {'orderid': 202208082145036506,'text':'666665ghsds488'}

# 参数列表
args = ['{orderid}','关联：{text}']

# 算法：遍历参数列表所有的参数
# 对每一个参数进行如下操作
# 尝试替换relations里面所有{键}的字符串为relations里面键的值
for i in range(len(args)):
    for  key in relations.keys():
        args[i] = str(args[i]).replace('{'+str(key)+'}',str(relations.get(key)))

print(args)

func(*args)

web = Web()
web.relation_dict['text'] = '这里是关联'
web.saveparams('mytime','{time}')
print(web.relation_dict)
web.input('{text}{mytime}-{random}')




